chore: disable vitest interopDefault, remove dotenvx#587
Merged
John-David Dalton (jdalton) merged 9 commits intoApr 16, 2026
Conversation
c6a9984 to
e4e67cc
Compare
@babel/traverse is a CJS package that exports { default: fn }.
In Node ESM (.mts), `import traverse from '@babel/traverse'`
resolves to the module object, not the function, causing
"traverse is not a function" at runtime.
Use `_traverse.default ?? _traverse` to unwrap correctly.
e4e67cc to
d91d5e6
Compare
Replace dotenvx with plain pnpm test in pre-commit hook. Remove @dotenvx/dotenvx devDependency (unused outside hook).
Let Node handle @babel/traverse as native CJS instead of having vite transpile it. This makes the plain default import work correctly.
…texts The ssr.external approach only works for single-file runs, not the full suite with isolate: false. Use runtime typeof check to handle both native CJS resolution and vite's SSR transform.
b205a31 to
7fa60cd
Compare
Vite's SSR transform wraps CJS module.exports as .default, so the traverse function ends up at traverseModule.default. Use a simple fallback pattern that works in both vite and native Node contexts.
7fa60cd to
b208043
Compare
Bill Li (billxinli)
approved these changes
Apr 16, 2026
import { default as traverse } works correctly with vite's SSR transform
and has proper types. Remove deps.interopDefault: false from both vitest
configs — the default (true) handles CJS interop correctly.
Use f9f6e265 (the SHA socket-registry uses internally) instead of eb53b17d which zizmor can't verify via impostor-commit check.
5343314 to
08ac95f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
deps.interopDefault: falsein both vitest configs so vitestmatches Node's native ESM-CJS interop (no auto-unwrapping of
.default)@babel/traverseimport in bundle-validation test — vite's SSRtransform wraps CJS
module.exportsas.default, so accesstraverseModule.defaultexplicitly (@types/babel__traversedoesn'tmodel this, hence
@ts-expect-error)@dotenvx/dotenvxfrom devDependenciesTest plan
pnpm exec vitest run --config .config/vitest.config.mts— 565 tests passpnpm exec vitest run --config .config/vitest.config.isolated.mts— 176 tests passpnpm exec tsgo --noEmit -p .config/tsconfig.check.json— clean